import request from "@/utils/request";

export const queryAllApi=()=>request.get("/emps")

export const queryPageApi=(page,pageSize,name,gender,begin,end)=>request.get(`/emps?page=${page}&pageSize=${pageSize}&name=${name}&gender=${gender}&begin=${begin}&end=${end}`)

export const queryAllDeptApi=()=>request.get("/depts")

export const addEmpApi=(emp)=>request.post("/emps",emp)

export const queryByIdApi=(id)=>request.get(`/emps/${id}`)

export const updateEmpApi=(emp)=>request.put("/emps",emp)


// 批量删除员工 ids
export const deleteEmpApi=(ids)=>{
    if(Array.isArray(ids)){
        return request.delete(`/emps?ids=${ids.join(",")}`)
    }else{
        return request.delete(`/emps?ids=${ids}`)
    }
}

// export const deleteEmpApi=(ids)=>request.delete(`/emps?ids=${ids.join(",")}`)